﻿package baidu.reader
{
    import baidu.reader.common.*;
    import baidu.reader.common.model.*;
    import baidu.ui.managers.*;
    import flash.display.*;
    import flash.events.*;

    public class ReaderMain extends Sprite
    {
        private var core:IReaderCore;

        public function ReaderMain()
        {
            this.initParams();
            var _loc_1:* = InstanceManager.createSingletonInstance(TocDataModel);
            _loc_1.getTocData();
            this.addEventListener(Event.ADDED_TO_STAGE, this.addToStageHandler);
            return;
        }// end function

        private function addToStageHandler(event:Event) : void
        {
            this.initScreen();
            this.initCore();
            return;
        }// end function

        private function initParams() : void
        {
            var _loc_1:* = InstanceManager.createSingletonInstance(AppConfigModel);
            _loc_1.loaderInfo = this.loaderInfo;
            return;
        }// end function

        private function initScreen() : void
        {
            var _loc_1:* = InstanceManager.createSingletonInstance(ScreenModel);
            _loc_1.stage = stage;
            return;
        }// end function

        private function initCore() : void
        {
            this.core = CoreFactory.getCore(CoreTypes.TXT);
            this.core.init(this.stage);
            return;
        }// end function

    }
}
